package com.leyou.item.api;

import com.leyou.item.pojo.SpecGroup;
import com.leyou.item.pojo.SpecParam;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RequestMapping("spec")
public interface SpecificationApi {


    /**
     * 查询产品参数
     * @param cid
     * @return
     */
    @GetMapping("groups/{cid}")
    List<SpecGroup> queryGroupsByCid(@PathVariable("cid") Long cid);

    //查询规格参数组,及组内参数
    @GetMapping("{cid}")
    List<SpecGroup> querySpecsByCid(@PathVariable("cid") Long cid);

    /**
     * 根据id查询产品规格参数
     * //http://api.leyou.com/api/item/spec/params?cid=76
     * @param gid
     * @return
     */
    @RequestMapping("params")
   List<SpecParam> queryGroupsByGid(@RequestParam(value = "gid", required = false) Long gid,
                                                            @RequestParam(value = "cid", required = false) Long cid,
                                                            @RequestParam(value = "generic", required = false) Boolean generic,
                                                            @RequestParam(value = "searching", required = false) Boolean searching);


    @GetMapping("group/param/{cid}")
    public List<SpecGroup> queryGroupsWithParams(@PathVariable("cid") Long cid);


    }
